# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator
from jms_point_hi.dwd.dwd_yl_oms_oms_waybill_incre_parse_hi import jms_dwd__dwd_yl_oms_oms_waybill_incre_parse_hi



jms_dwd__dwd_yl_oms_oms_waybill_last_hour_status = SparkSqlOperator(
    task_id='jms_dwd__dwd_yl_oms_oms_waybill_last_hour_status',
    email=['yushuo@jtexpress.com','yl_bigdata@yl-scm.com'],
    master='yarn',
    name='jms_dwd__dwd_yl_oms_oms_waybill_last_hour_status_{{ execution_date | cst_hour }}',
    sql='jms_point_hi/dwd/dwd_yl_oms_oms_waybill_last_hour_status/execute.sql',
    pool_slots=2,
    driver_cores=4,
    driver_memory='8g',
    executor_cores=4,
    executor_memory='12G',
    num_executors=80,
    conf={'spark.dynamicAllocation.enabled'                  : 'true',
          'spark.shuffle.service.enabled'                    : 'true',
          'spark.dynamicAllocation.maxExecutors'             : 100,
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 600,
          'spark.network.timeout' : 600,
          'spark.sql.sources.partitionOverwriteMode'         : 'dynamic',
          'spark.executor.memoryOverhead'                    : '2G',
          'spark.sql.shuffle.partitions'                     : 1900,
          'spark.shuffle.file.buffer' : '64K',
          'spark.shuffle.memoryFraction': '0.8',
          'spark.executor.extraJavaOptions': '-XX:+UseG1GC -XX:ParallelGCThreads=4',
          'spark.shuffle.consolidateFiles':'true'
    },
    hiveconf={'hive.exec.dynamic.partition'             : 'true',  # 动态分区
              'hive.exec.dynamic.partition.mode'        : 'nonstrict',
              'hive.exec.max.dynamic.partitions'        : 200,  # 最大分区
              'hive.exec.max.dynamic.partitions.pernode': 200,  # 最大分区
              },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=50),
    retries=0,
    sla=timedelta(hours=1))


jms_dwd__dwd_yl_oms_oms_waybill_last_hour_status << [jms_dwd__dwd_yl_oms_oms_waybill_incre_parse_hi]



